package com.googlecode.animator.data.materials
{
	import com.googlecode.animator.data.IValueObject;
	
	public class TextMaterialVO extends MaterialVO
	{
	
		public static const TYPE:String = "TextMaterial";
		
		public var text:String;
		
		public var fontSize:uint = 36;
		
		public var font:String = "Arial";
		
		public var fontColor:uint = 0;
		
		public var transparent:Boolean = true;
		
		public var animated:Boolean = true;
		
		public var width:uint = 500;
		
		public var height:uint = 500;
		
		public function TextMaterialVO()
		{
			this.smooth = true;
		}
		
		override public function clone(src:* = null):IValueObject
		{
			var clone:IValueObject = super.clone(new TextMaterialVO());
			
			(clone as TextMaterialVO).text = this.text;
			(clone as TextMaterialVO).fontSize = this.fontSize;
			(clone as TextMaterialVO).font = this.font;
			(clone as TextMaterialVO).fontColor = this.fontColor;
			(clone as TextMaterialVO).transparent = this.transparent;
			(clone as TextMaterialVO).animated = this.animated;
			(clone as TextMaterialVO).width = this.width;
			(clone as TextMaterialVO).height = this.height;
			
			return (clone as TextMaterialVO);
		}
		
		override public function toXML(src:XML = null):XML
		{
			var xml:XML = super.toXML(new XML(<{TYPE}></{TYPE}>));
			
			xml.appendChild(<text>{this.text}</text>);
			xml.appendChild(<fontSize>{this.fontSize}</fontSize>);
			xml.appendChild(<font>{this.font}</font>);
			xml.appendChild(<fontColor>{this.text}</fontColor>);

			return xml;
		}
		
		override public function fromXML(src:XML):void
		{
			super.fromXML(src);
			
			this.text = src.text;
			this.fontSize = src.fontSize;
			this.font = src.font;
			this.fontColor = src.fontColor;
	
		}
	}
}